package com.sap.apitest2.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "Result")
@Entity
@Table(name="t_result")
public class Result extends AbstractEntity {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="result_id")
	private Long id;
	
	@Column(name="result_name", length=100)
	private String name;
	
	@Column(name="subcase_id")
	private Long subCaseId;
	
	@Column(name="step_id")
	private Long stepId;	

	/*@Column(name="response", length=RESPONSE_LENGTH)
	private String response;*/
	@Lob
	private String response;
	
	
	
	@Column(name="status")
	private Integer status;
	
	@Column(name="result")
	private Integer result;
	
	@Column(name="comment", length=200)
	private String comment;
		
	@Column(name="executor", length=100)
	private String executor;	
	
	@Column(name="date")
	private Date date;
	
	@Column(name="start_time")
	private Date startTime;
	
	@Column(name="end_time")
	private Date endTime;	
	
	/*@Transient
	//@XmlElement(name = "exp_result")
	private String expectedResponse;*/
	//@Transient
	@Lob
	@Column(name="exp_response")
	private String expectedResponse;
	
	
	@Override
	public Long getKey() {
		return id;
	}
	
	
	@Override
	public void acceptValue(AbstractEntity input) {
		if(input!=null && input instanceof Result){
			Result param=(Result)input;
			this.setName(param.getName());
			this.setSubCaseId(param.getSubCaseId());
			this.setStepId(param.getStepId());
			this.setResponse(param.getResponse());
			this.setStatus(param.getStatus());
			this.setComment(param.getComment());
			this.setExecutor(param.getExecutor());
			this.setDate(param.getDate());
			this.setExpectedResponse(param.getExpectedResponse());
			this.setResult(param.getResult());
		}
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) { 
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSubCaseId() {
		return subCaseId;
	}

	public void setSubCaseId(Long subCaseId) {
		this.subCaseId = subCaseId;
	}

	public Long getStepId() {
		return stepId;
	}

	public void setStepId(Long stepId) {
		this.stepId = stepId;
	}

	public String getResponse() {
		return response;
	}

	public void setResponse(String response) {
		this.response = response;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getResult() {
		return result;
	}


	public void setResult(Integer result) {
		this.result = result;
	}


	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getExecutor() {
		return executor;
	}

	public void setExecutor(String executor) {
		this.executor = executor;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}


	public Date getStartTime() {
		return startTime;
	}


	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}


	public Date getEndTime() {
		return endTime;
	}


	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}


	public String getExpectedResponse() {
		return expectedResponse;
	}


	public void setExpectedResponse(String expectedResponse) {
		this.expectedResponse = expectedResponse;
	}
	
	
	
	
}
